package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.NursingLevelDto;
import com.zzyl.service.NursingLevelService;
import com.zzyl.vo.NursingLevelVo;
import com.zzyl.vo.NursingProjectVo;
import com.zzyl.vo.RoomVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/nursingLevel")
@Api(tags = "护理等级")
public class NursingLevelController extends BaseController {
    @Autowired
    private NursingLevelService nursingLevelService;

    @GetMapping("listAll")
    public ResponseResult<List<NursingLevelVo>> getListAll() {
        return success(nursingLevelService.getListAll());
    }

    @PostMapping("/insert")
    public ResponseResult insert(@RequestBody NursingLevelDto nursingLevelDto) {
        nursingLevelService.insert(nursingLevelDto);
        return success();
    }

    @GetMapping("listByPage")
    public ResponseResult<PageResponse<NursingLevelVo>> getListByPage(String name, Integer page, Integer pageSize,Integer status){
        return success(nursingLevelService.getListByPage(name,page,pageSize,status));
    }

    @GetMapping("/{id}")
    public ResponseResult<NursingLevelVo> getById(@PathVariable Integer id) {
        return success(nursingLevelService.getById(id));
    }

    @PutMapping("/update")
    public ResponseResult update(@RequestBody NursingLevelDto nursingLevelDto) {
        nursingLevelService.update(nursingLevelDto);
        return success();
    }

    @DeleteMapping("/delete/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        nursingLevelService.delete(id);
        return success();
    }

    @PutMapping("/{id}/status/{status}")
    public ResponseResult updateStatus(@PathVariable Integer id,@PathVariable Integer status){
        nursingLevelService.updateStatus(id,status);
        return success();
    }
}
